//
//  KABillTableViewCell.m
//  KeepAccounts
//
//  Created by honeyrr on 2017/10/5.
//  Copyright © 2017年 honeyrr. All rights reserved.
//

#import "KABillTableViewCell.h"
#import "KADataBaseModel.h"

@interface KABillTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *billimageView;
@property (weak, nonatomic) IBOutlet UILabel *outlayName;
@property (weak, nonatomic) IBOutlet UILabel *outlayMoney;
@property (weak, nonatomic) IBOutlet UILabel *outlayInfo;
@property (weak, nonatomic) IBOutlet UILabel *incomeName;
@property (weak, nonatomic) IBOutlet UILabel *incomeMoney;
@property (weak, nonatomic) IBOutlet UILabel *incomeInfo;

@end

@implementation KABillTableViewCell

-(void)setDbMobel:(KADataBaseModel *)dbMobel
{
    _dbMobel = dbMobel;
    if ([dbMobel.billtype isEqualToString:@"支出"]) {
        self.outlayName.text = dbMobel.name;
        self.outlayMoney.text = [NSString stringWithFormat:@"-%@",dbMobel.money];
        self.outlayInfo.text = dbMobel.remark;
        
        self.incomeName.hidden = YES;
        self.incomeMoney.hidden = YES;
        self.incomeInfo.hidden = YES;
    } else {
        self.incomeName.text = dbMobel.name;
        self.incomeMoney.text = [NSString stringWithFormat:@"+%@",dbMobel.money];
        self.incomeInfo.text = dbMobel.remark;
        
        self.outlayName.hidden = YES;
        self.outlayMoney.hidden = YES;
        self.outlayInfo.hidden = YES;
    }
    self.billimageView.image = [UIImage imageNamed:dbMobel.imageName];
        
}
//
//-(void)setBillData:(NSDictionary *)billData
//{
//    _billData = billData;
//
//    if ([billData[@"billtype"] isEqualToString:@"支出"]) {
//        self.outlayName.text = billData[@"name"];
//        self.outlayMoney.text = [NSString stringWithFormat:@"-%@",billData[@"money"]];
//        self.outlayInfo.text = billData[@"remark"];
//
//        self.incomeName.hidden = YES;
//        self.incomeMoney.hidden = YES;
//        self.incomeInfo.hidden = YES;
//    } else {
//        self.incomeName.text = billData[@"name"];
//        self.incomeMoney.text = [NSString stringWithFormat:@"+%@",billData[@"money"]];
//        self.incomeInfo.text = billData[@"remark"];
//
//        self.outlayName.hidden = YES;
//        self.outlayMoney.hidden = YES;
//        self.outlayInfo.hidden = YES;
//    }
//
//}

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
